package org.mines.douai.j2ee.webservices;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

public class WeatherWebServiceConsumer {

	public static void main(String[] args) {
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutFaultInterceptors().add(new LoggingOutInterceptor());
		factory.setServiceClass(WeatherWebService.class);
		factory.setAddress("http://localhost:9090/weatherWebService");
		WeatherWebService client = (WeatherWebService) factory.create();

		String reply = client.getWeatherValue("us");
		System.out.println("Server said: " + reply);
		System.exit(0);
	}

}
